{% extends 'base.html' %}

{% block header %}
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <a class="navbar-brand" href="/">BlogSystem-乐在分享</a>
                <span class="navbar-brand">个人站点后台管理</span>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">

                <ul class="nav navbar-nav navbar-right">

                    <li><a href="#"><span id="user_icon"
                                          class="glyphicon glyphicon-user"></span>{{ request.user.username }}</a>
                    </li>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                           aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="#">修改密码</a></li>
                            <li><a href="#">修改头像</a></li>
                            <li><a href="/blogsystem/logout/">注销登陆</a></li>
                            <li role="separator" class="divider"></li>
                            <li><a href="#">Separated link</a></li>
                        </ul>
                    </li>

                </ul>
            </div><!-- /.navbar-collapse -->
        </div><!-- /.container-fluid -->
    </nav>
{% endblock %}

{% block content %}
    <div class="container">
        <div class="row">
            <div class="col-md-3">
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title">操作</h3>
                    </div>
                    <div class="panel-body">
                        <a class="btn btn-success" href="/blogsystem/cn_backend/add_article/">添加一篇文章</a>
                    </div>
                </div>
            </div>
            <div class="col-md-9">
                <div>
                    <table class="table">
                        <table class="table">
                            <thead>
                            <tr>
                                <th>标题</th>
                                <th>评论数</th>
                                <th>点赞数</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {% for article in article_list %}
                                <tr>
                                    <td>
                                        <a href="/blogsystem/{{ request.user.username }}/articles/{{ article.pk }}/">{{ article.title }}</a>
                                    </td>
                                    <td>{{ article.comment_count }}</td>
                                    <td>{{ article.up_count }}</td>
                                    <td>
                                        <a href="delete/{{ article.pk }}">删除</a>
                                        <a href="/blog/edit/{{ article.pk }}">编辑</a>
                                    </td>
                                </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                    </table>
                </div>
            </div>
        </div>
    </div>
{% endblock %}